package main

import (
	"WZ_law-api/cm"
	"WZ_law-api/routers"

	"fmt"
	"net/http"
)

func root() string {
	return "welcome to visit SZU_Blockchain_Research Center"
}
func main() {
	chain := cm.NewClientManager() //新建一个chain对象，包含client和contract

	//测试API
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, root())
	})

	//Add API
	http.Handle("/api/upload/chain", routers.NewChainHandler(chain))
	//verify API
	http.Handle("/api/verify/chain", routers.NewVerifyHandler(chain))

	//register http port
	http.ListenAndServe(":8000", nil)
}
